page allocator: add mfn_valid() check to free_heap_pages() and scrub_pages()
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 22 Jul 2009 13:06:21 +0000 (14:06 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 22 Jul 2009 13:06:21 +0000 (14:06 +0100)
commit5e3d36c2c840c5da77065b0676c0f2a64fee638a
tree6a1ccaf7ebf5e3219e76d82c317b210f2d05c83c
parente9b46d3b2368def31502d2a2bbd7a6fba5fd1dc6
page allocator: add mfn_valid() check to free_heap_pages() and scrub_pages()

The changesets, 19913:ef38784f9f85 and 19914:d6c1d7992f43 eliminates
boot allocator bitmap which is also used for buddy allocator bitmap.
With those patches, xen/ia64 doesn't boot because page allocator
touches struct page_info which doesn't exist.
That happends because memory is populated sparsely on ia64
and struct page_info is so.

This patches fixes ia64 boot failure.
In fact, this is also a potential bug on x86. max_page seems
to be well aligned so that MAX_ORDER loop check prevented
to be bug appear.

- fix free_heap_pages().
  When merging chunks, buddy page_info() doesn't always exists.
  So check it by mfn_valid().

- fix scrub_pages()
  On ia64 page_info() is sparsely populated, so struct page_info
  doesn't always exist. Check it by mfn_valid()

- offline_pages(), online_pages() and query_page_offline()
  Also replace "< max_page" check with mfn_valid() for consistency.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
xen/common/page_alloc.c